// Package hello_world
// Created by GoLand
// @User: lenora
// @Date: 2023/11/21
// @Time: 15:12

package main

import (
	"fmt"
	"sync"
)

func main() {
	println("Hello Go")
	//func1()
	//deferClosureLoopV1()
	//deferClosureLoopV3()
	//loopTips()
	//Struct()
	//LinkList1()
	//generics.LinkListFunc()

	//println(order(2, 5, 3))

	//loopvar()
	deferClosureLoopV3()
	//generics.UseMax()
}

func order(a, b, c int) (int, int, int) {
	if a > b {
		b, a = a, b
	}
	if b > c {
		c, b = b, c
	}
	if a > c {
		c, a = a, c
	}
	return a, b, c
}

func loopvar() {
	sl := []int{11, 12, 13, 14, 15}
	var wg sync.WaitGroup
	for i, v := range sl {
		wg.Add(1)
		go func() {
			fmt.Printf("%d:%d\n", i, v)
			wg.Done()
		}()
	}
	wg.Wait()

	for i := 0; i < len(sl); i++ {
		wg.Add(1)
		go func() {
			v := sl[i]
			fmt.Printf("%d:%d\n", i, v)
			wg.Done()
		}()
	}
	wg.Wait()
}
